package com.xfatm.simplebrowser.entity;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by wenjie on 2018/3/14.
 * 设置保存bean
 */

public class BrowserSetting {

    private static BrowserSetting BROWSER_SETTING;

    //是否自动隐藏头部导航栏
    private boolean isAutoHideHead;
    private Context context;
    private SharedPreferences sharedPreferences;
    private SharedPreferences.Editor editor;

    public BrowserSetting(Context context){
        this.context=context;
        sharedPreferences=context.getSharedPreferences("xfatm",Context.MODE_PRIVATE);
        editor=sharedPreferences.edit();
        //读取配置
        isAutoHideHead=sharedPreferences.getBoolean("isAutoHideHead",false);
        BROWSER_SETTING=this;
    }

    public boolean isAutoHideHead() {
        return isAutoHideHead;
    }

    public void setAutoHideHead(boolean autoHideHead) {
        editor.putBoolean("isAutoHideHead",autoHideHead);
        editor.commit();
        isAutoHideHead = autoHideHead;
    }

    public static BrowserSetting getSetting(){
        return BROWSER_SETTING;
    }
}
